#include "Element_data.h"
#include "Sql_list.h"

Element_data data[50]=
{
    {.name = "刘备",.sex="男",.sco=60,.age=18,.id=1},
    {.name = "关羽",.sex="男",.sco=60,.age=18,.id=2},
    {.name = "张飞",.sex="男",.sco=60,.age=18,.id=3},
    {.name = "赵云",.sex="男",.sco=60,.age=18,.id=4},
    {.name = "马超",.sex="男",.sco=60,.age=18,.id=5}

};

void test(void)
{
    //创建表
    Sql_list S_guo;
    Sql_list S_guo2;
    Sql_list *L = &S_guo;
    Sql_list *L1= &S_guo2;
    //初始化
    Init_Sql_List(L);
    Init_Sql_List(L1);

    printf("\n==================插入==================\n");

    //尾插
    tail_insert_list(L,data[0]);
    tail_insert_list(L,data[1]);
    tail_insert_list(L,data[2]);
    tail_insert_list(L,data[3]);
    tail_insert_list(L,data[4]);

    tail_insert_list(L1,data[0]);
    tail_insert_list(L1,data[1]);
    tail_insert_list(L1,data[2]);
    tail_insert_list(L1,data[3]);
    tail_insert_list(L1,data[4]);

    //打印
    printf_Sql_List(L);

    //尾删
    taid_del_list(L);

    printf("\n==================删除==================\n");
    
    //打印
    printf_Sql_List(L);

    //在任意位置插入
    pos_insert_list(L,3,data[4]);

    printf("\n=============在任意位置插入=============\n"); 
    
    //打印
    printf_Sql_List(L);

    printf("\n=============在任意位置删除=============\n"); 

    //在任意位置删除
    pos_det_list(L,1);

    //打印
    printf_Sql_List(L);

    printf("\n==================合并==================\n");
    
    //合并
    //Sql_list L3 = 
    Merge_Sql_Lists(L,L1);

    //打印
    printf_Sql_List(L);

    printf("\n==================查找==================\n");

    //查找
    find_by_name(L,"刘备");
    
    //打印
    //printf_Sql_List(L);
}
int main()
{
    test();
    return 0;
}